package com.timeDeal.servlet;








import com.timeDeal.bean.ShijianchushouBean;
import com.timeDeal.bean.UserBean;
import com.timeDeal.bean.XuqiufabuBean;
import com.timeDeal.service.ShijianchusouService;
import com.timeDeal.service.UserService;
import com.timeDeal.service.XuqiuService;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * Created by Administrator on 2016/7/24.
 */

public class ShijianXiangqingServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, IOException, IOException {
        String id = request.getParameter("id");
        UserService userService = new UserService() ;
        UserBean loginuser = (UserBean) request.getSession().getAttribute("USER") ;
        String liulanrenid = StringUtils.defaultString(request.getParameter("liulanren"),String.valueOf(loginuser.getYonghuid()));
        UserBean  liulanren =   userService.getAuserByid(Integer.valueOf(liulanrenid));
        ShijianchusouService shijianchusouService = new ShijianchusouService();
        ShijianchushouBean shijianchushouBean = shijianchusouService.getAShijianChushouById(Integer.valueOf(id)) ;
        request.setAttribute("shijian", shijianchushouBean);
        request.setAttribute("liulanren", liulanren);
        request.getRequestDispatcher("/user/shijianchushou/shijiandetail.jsp").forward(request,response);
    }
}